package com.kll.carolinehmibiz.common.constant;

import android.content.Context;
import android.graphics.Typeface;

/**
 * ====================================================
 * Created by Ziliang Cai on 2022/3/3 15:48
 * <a href="mailto:752577456@qq.com">Contact me</a>
 * ====================================================
 */
public class FontConstants {
    public static Typeface PF_BOLD;
    public static Typeface PF_MEDIUM;
    public static Typeface PF_HEAVY;

    public static void init(Context context) {
        if(PF_BOLD == null) {
            PF_BOLD = Typeface.createFromAsset(context.getApplicationContext().getAssets(), "PingFangBold.ttf");
            PF_MEDIUM = Typeface.createFromAsset(context.getApplicationContext().getAssets(), "PingFangMedium.ttf");
            PF_HEAVY = Typeface.createFromAsset(context.getApplicationContext().getAssets(), "PingFangHeavy.ttf");
        }
    }

    public static Typeface getBoldTypeface(Context context){
        if(PF_BOLD == null) {
            init(context);
        }
        return PF_BOLD;
    }

    public static Typeface getMediumTypeFace(Context context){
        if(PF_BOLD == null) {
            init(context);
        }

        return PF_MEDIUM;
    }

    public static Typeface getHeavyTypeFace(Context context){
        if(PF_BOLD == null) {
            init(context);
        }
        return PF_HEAVY;
    }
}
